/**
 * createor: zc
 * email: zc8023zs@163.com
 * create_time: 2020/3/14 13:46:24
 */
import request from '@/utils/request'

export function fetchList(query) {
  return request({
    url: '/system/sysrole/getSysRoleList',
    method: 'post',
    params: query
  })
}

export function createObj(data) {
  return request({
    url: '/system/sysrole/addSysRole',
    method: 'post',
    params: data
  })
}

export function updateObj(data) {
  return request({
    url: '/system/sysrole/updateSysRole',
    method: 'post',
    params: data
  })
} 

export function getMenuTree(data){
  return request({
    url: '/system/sysmenu/getSysMenuList',
    method: 'post',
    params: data
  })
}

export function getPermissionsTree(data){
  return request({
    url: '/system/sysrole/getSysPermissionsList',
    method: 'post',
    params: {role_menu:data.role_menu}
  })
}

export function updateRoleMenu(data){
  return request({
    url: '/system/sysrole/menuAuthorization',
    method: 'post',
    data
  });
}

export function updateRolePermission(data){
  return request({
    url: '/system/sysrole/permissionsAuthorization',
    method: 'post',
    data
  });
}

export function deleteObj(data) {
  return request({
    url: '/system/sysrole/deleteSysRole',
    method: 'post',
    params:{id:data.id}
  })
} 